//
//  LMJTopicCell.m
//  EPA
//
//  Created by lanou3g on 16/4/22.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "LMJTopicCell.h"

@interface LMJTopicCell()
@property (weak, nonatomic) IBOutlet UITextView *ContentTextView;

@property (weak, nonatomic) IBOutlet UIImageView *coverimgView;
@property (weak, nonatomic) IBOutlet UILabel *titleLable;
@property (weak, nonatomic) IBOutlet UILabel *addtime_Lable;
//第二个小字典属性
@property (weak, nonatomic) IBOutlet UILabel *viewLable;

@property (weak, nonatomic) IBOutlet UILabel *likeLable;
@property (weak, nonatomic) IBOutlet UILabel *commentLable;
@end
@implementation LMJTopicCell
-(void)layoutSubviews {
    self.titleLable.text = self.model.title;
    self.addtime_Lable.text = self.model.addtime_f;
    //解析图片
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.model.coverimg]];
    NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession]dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        if (data) {
            dispatch_async(dispatch_get_main_queue(), ^{
                self.coverimgView.image = [UIImage imageWithData:data];
            });
        }
    }];
    [dataTask resume];
    //
    self.viewLable.text = [NSString stringWithFormat:@"%ld",self.model.counterList.view];
    self.likeLable.text = [NSString stringWithFormat:@"%ld",self.model.counterList.like];
    self.commentLable.text = [NSString stringWithFormat:@"%ld",self.model.counterList.comment];
    self.ContentTextView.text = self.model.content;
   
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
